package com.ra.model.deal;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Transient;

import java.lang.Float;

@Embeddable
public class DealSlab {
	
	/*
	 * Minimum number of units of a product for this deal slab.
	 * Defaults to 1
	 */
	@Transient
	public static final Integer MIN_UNITS = 1;
	
	/*
	 * Maximum number of units of a product for this deal slab.
	 * Defaults to infinity. We use -1 to represent infinity.
	 * 
	 * NOTE: The default deal slab offers a single price for 
	 *       any number of units i.e. from 1 to infinity
	 */
	@Transient
	public static final Integer MAX_UNITS = -1;
	
	@Column(name="VERSION", nullable=false)
	private int version = 0;
	
	public void setVersion(int version) {
		this.version = version;
	}
	
	public int getVersion() {
		return version;
	}
	
	@Column(name = "PRICE", nullable = false)
    private Float price;
    
    public void setPrice(Float price) {
    	this.price = price;
    }
    
    public Float getPrice() {
    	return price;
    }
    
    // Minimum number of units for this slab
    @Column(name = "MIN_UNITS", nullable = false)
    private Integer minUnits = MIN_UNITS;
    
    public void setMinUnits(Integer minUnits) {
    	this.minUnits = minUnits;
    }
    
    public Integer getMinUnits() {
    	return minUnits;
    }
    
    // Maximum number of units for this slab
    @Column(name = "MAX_UNITS", nullable = false)
    private Integer maxUnits = MAX_UNITS;
    
    public void setMaxUnits(Integer maxUnits) {
    	this.maxUnits = maxUnits;
    }
    
    public Integer getMaxUnits() {
    	return maxUnits;
    }
}
